
from datetime import timedelta
from redis import StrictRedis

# 配置信息提取
class Config:
    # 是否开启debug
    DEBUG = True
    # 随机字符串密钥
    SECRET_KEY = 'test'
    # sql的地址初始化
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@127.0.0.1:3306/newinfo'
    # sql是否开启追宗
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    # redis的链接地址
    REDIS_URL = '127.0.0.1'
    # 配置redis端口
    REDIS_PORT = 6379
    # flask-session存储的数据库,启用redis
    SESSION_TYPE = 'redis'
    # flask-session初始化 主动传递一个redis对象
    SESSION_REDIS = StrictRedis(host=REDIS_URL, port=REDIS_PORT)
    # 设置session的过期时间
    PERMANENT_SESSION_LIFETIME = timedelta(days=7)

# 开发环境的配置
class DevConfig(Config):
    DEBUG = True

class PorConfig(Config):
    DEBUG = False

cong_dic = {
    'dev':DevConfig,
    'por':PorConfig
}